<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>Random</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">Random()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#006666"><b>Random</b></font>(Maximum [, Minimum])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Returns a random number from zero to the given maximum value (both values included). 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>Maximum</i></td>
<td width="90%"> 
 
The maximum value. This value needs to be positive (zero included) and 
may not exceed the maximum positive <a href="../reference/variables.html">integer</a> value. 

 

</td></tr>
<tr><td><i>Minimum (optional)</i></td>
<td> 
 
The minimum value. It may not exceed the maximum value. If specified, the random 
number will be from the minimum value to the maximum value (both values included). 
This value needs to be positive (zero included) and may not exceed the maximum positive <a href="../reference/variables.html">integer</a> value. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Returns a value from zero to the maximum value (both values included), unless a minimum value is specified. 

 

</blockquote><p><b>Remarks</b></p><blockquote>



Additionally <a href="randomseed.html">RandomSeed()</a> may be used to change the random number seed. 
<a href="randomdata.html">RandomData()</a> can be used to fill a memory buffer with random data. 
<a href="../sort/randomizearray.html">RandomizeArray()</a> or <a href="../sort/randomizelist.html">RandomizeList()</a> can be used, to randomize the elements of an array 
or a list. 
<br>
<br>
<b>Note:</b> This command uses a pseudorandom number generator which is very fast and produces 
randomly looking output but it is not strong enough for cryptographic purposes. 
The slower <a href="../cipher/cryptrandom.html">CryptRandom()</a> command can be used if more secure random 
number generation is required. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">Repeat</font></b>
    Dice =<font color="#006666"> Random</font>(6, 1)  <font color="#006666">; get a value between 1 and 6, including 1 and 6</font>
    Choice =<font color="#006666"> MessageRequester</font>("Roll the dice", "You got a " + Dice + ", roll again?", <font color="#924B72">#PB_MessageRequester_YesNo</font>)
  <b><font color="#006666">Until</font></b> Choice = <font color="#924B72">#PB_MessageRequester_No</font>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="randomseed.html">RandomSeed()</a>, <a href="randomdata.html">RandomData()</a>, <a href="../cipher/cryptrandom.html">CryptRandom()</a>, <a href="../sort/randomizearray.html">RandomizeArray()</a>, <a href="../sort/randomizelist.html">RandomizeList()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=radian.html>Radian()</a> - <a href=index.html>Math Index</a> - <a href=randomdata.html>RandomData()</a> -&gt;



</body></html>